package day15;

public class ThreadAndRunable {
    public static void main(String[] args) {
        Runnable r=new T2();
        Thread t3=new Thread(r);
        Thread t4=new Thread(r);
        t3.start();
        t4.start();

    }

}
class T1 extends Thread{
    private static int ticket=10;

    @Override
    public void run() {
        for (int i = 0; i <10 ; i++) {
            System.out.println(Thread.currentThread().getName()+"正在卖票"+ticket+"piao");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class T2 implements Runnable{
    private  int ticket=10;
    @Override
    public void run() {
        for (int i = 0; i <10 ; i++) {
            System.out.println(Thread.currentThread().getName()+"正在卖票"+ticket+"piao");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}